<div class="box">				
	<div class="box">
			<div class="box-top"></div>
			<div class="box-content">
						<div class="head">
							<h2>{$page_title}</h2>	
							<ul class="filter">
								<li class="current"><a href="{function name="url_pack" value="uc_account#index"}">{$LANG.UC_ACCOUNT}</a></li>
								<li><a href="{function name="url_pack" value="uc_account#consignee"}">{$LANG.UC_CONSIGNEE}</a></li>
							</ul>					
						</div>
						<div class="sect" style="position:relative;">
						<form method="post" action="{function name="url_pack" value="uc_account#save"}" name="modify">
								<table width="100%">
									<tr>
										<td>
											
											<div class="field email">
											<label for="settings-email-address">Email</label>
											<input type="text" value="{$user_info.email}" {if $user_info.email neq ''}readonly="readonly"{/if} class="f-input {if $user_info.email neq ''}readonly{/if}" id="settings-email-address" name="email" size="30">
											</div>
											<div class="blank"></div>
											<div class="field username">
												<label for="settings-username">{$LANG.USER_TITLE_USER_NAME}</label>
												<input type="text" value="{$user_info.user_name}" readonly="readonly" class="f-input readonly" id="settings-username" name="user_name" size="30">
											</div>
											<div class="blank"></div>
											<div class="field password">
												<label for="settings-password">{$LANG.USER_TITLE_USER_NEW_PWD}</label>
												<input type="password" class="f-input" id="settings-password" name="user_pwd" size="30">
												<span class="hint">{$LANG.USER_TITLE_USER_NEW_PWD_TIP}</span> 
											</div>
											<div class="blank"></div>
											<div class="field password">
												<label for="settings-password-confirm">{$LANG.USER_TITLE_USER_CONFIRM_PWD}</label>
												<input type="password" class="f-input" id="settings-password-confirm" name="user_pwd_confirm" size="30">
											</div>
											<div class="blank"></div>
											<div class="field mobile">
												<label for="settings-mobile">{$LANG.USER_TITLE_MOBILE}</label>
												<input type="text" value="{$user_info.mobile}" class="f-input" id="settings-mobile" name="mobile" size="30">
												<span class="hint">{$LANG.USER_TITLE_MOBILE_TIP}</span> 
											</div>
											<div class="blank"></div>
			
											{foreach from=$field_list item=field_item}
											<div class="field {$field_item.field_name}">
													<label for="{$field_item.field_name}">{$field_item.field_show_name}</label>
													{if $field_item.input_type eq 0}
													<input type="text" value="{$field_item.value}" class="f-input" id="settings-{$field_item.field_name}" name="{$field_item.field_name}" size="30">
													{else}
													<select name ="{$field_item.field_name}" id="settings-{$field_item.field_name}">
														{foreach from=$field_item.value_scope item=value_item}
														<option value="{$value_item}" {if $value_item eq $field_item.value}selected="selected"{/if}>{$value_item}</option>
														{/foreach}
													</select>
													{/if}
											</div>
											<div class="blank"></div>
											{/foreach}
											<div class="clear"></div>
											<div class="act">
													<input type="hidden" value="{$user_info.id}" name="id" />
													<input type="submit" class="formbutton" id="settings-submit" name="commit" value="{$LANG.MODIFY}">
											</div>
											
										</td>
										<td valign="top" style="width:180px;">
											<?php if(intval(app_conf("USER_AVATAR"))==1){?>
											
												<img id="avatar" src="{function name="url_pack" value="avatar" id=$user_info.id}" style="width:100px; height:100px; border:2px solid #f2f2f2;" />
												<div class="blank"></div>
												<input type="button" value="{$LANG.UC_AVATAR}" onclick="change_avatar({$user_info.id});" class="formbutton" />
											
											<?php }?>											
										</td>
									</tr>
								</table>
								
							</form>
						</div><!--end sect-->
			</div>
			<div class="box-bottom"></div>
	</div>
</div>

<script type="text/javascript">
$(document).ready(function(){

	$("#settings-submit").click(function(){
		
		if($.trim($("#settings-email-address").val()).length == 0)
		{
			$("#settings-email-address").focus();
			$.showErr("{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$LANG.USER_TITLE_EMAIL}");
			
			return false;
		}
		
		if(!$.checkEmail($("#settings-email-address").val()))
		{
			$("#settings-email-address").focus();			
			$.showErr("{function name="sprintf" format=$LANG.FORMAT_ERROR_TIP value=$LANG.USER_TITLE_EMAIL}");
			return false;
		}
		
		if($.trim($("#settings-password").val())!=''&&!$.minLength($("#settings-password").val(),4,false))
		{
			$("#settings-password").focus();
			$.showErr("{function name="sprintf" format=$LANG.FORMAT_ERROR_TIP value=$LANG.USER_TITLE_USER_PWD}");	
			return false;
		}
		
		if($("#settings-password-confirm").val() != $("#settings-password").val())
		{
			$("#settings-password-confirm").focus();
			$.showErr("{$LANG.USER_PWD_CONFIRM_ERROR}");			
			return false;
		}

		if(!$.checkMobilePhone($("#settings-mobile").val()))
		{
			$("#settings-mobile").focus();			
			$.showErr("{function name="sprintf" format=$LANG.FORMAT_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");	
			return false;
		}		
		
		{if app_conf("MOBILE_MUST") eq 1}
			if($.trim($("#settings-mobile").val()).length == 0)
			{
				$("#settings-mobile").focus();
				$.showErr("{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");
				
				return false;
			}
		{/if}

		{foreach from=$field_list item=field_item}
			{if $field_item.is_must eq 1}
			if($("#settings-{$field_item.field_name}").val()=='')
			{
				$.showErr("{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$field_item.field_show_name}");	
				$("#settings-{$field_item.field_name}").focus();
				return false;
			}
			{/if}
		{/foreach}

		
	});
});

function change_avatar(id)
{
	$.weeboxs.open(APP_ROOT+"/uc_avatar/index.php?uid="+id, {contentType:'ajax',showButton:false,title:LANG['UC_AVATAR'],width:460,height:477,onclose:function(){ 
		document.getElementById("avatar").src = document.getElementById("avatar").src+"&r="+Math.random();
	}});	
}
</script>